package com.scf.common.vo;

/**
 * @author sunchuanfu
 */
public class RestResultFactory {

    public static <T> RestResult<T> createResult(int status, T data, String message) {
        RestResult<T> result = RestResult.newInstance();
        result.setStatus(status);
        result.setData(data);
        result.setMessage(message);
        return result;
    }

    /**
     * success
     */
    public static <T> RestResult<T> createSuccessResult(T data) {
        return createResult(0, data, null);
    }

    /**
     * fail
     */
    public static <T> RestResult<T> createErrorResult(String message) {
        return createResult(3, null, message);
    }

}

